/**
 * @file rank/popularize/luogu1540/main.cpp
 * @brief
 * @see
 * @author Ruiming Guo (guoruiming@stu.scu.edu.cn)
 * @copyright 2022
 * @date 2022/7/8 11:57:27
 **/

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
const int N = 1010;
int q[N];
bool inq[N];
int hh, tt = -1;
int m, n;
int main() {
  // High rating and good luck!
  cin >> m >> n;
  int nLookup = 0;
  for (int i = 0; i < n; ++i) {
    int w;
    cin >> w;
    if (!inq[w]) {
      nLookup++;
      if (tt - hh + 1 >= m) {
        inq[q[hh]] = false;
        hh++;
      }
      q[++tt] = w;
      inq[w] = true;
    }
  }
  cout << nLookup << endl;
  return 0;
}
